#include "serialport.h"

namespace robot {
Serialport::Serialport(const char *serialport_name) {
	serial_error result = open_serialport(serialport_name, read_write_mode,
			hDev);
	if (result == operator_success) {
		m_state = open_state;
	}
}

state Serialport::is_open() {
	return m_state;
}

Serialport::~Serialport() {
	close_serialport(hDev);
	m_state = close_state;
}

void Serialport::write(const char *buf, int length) {
	write_serialport(hDev, buf, length);
}

void Serialport::read(char *buf, int length) {
	read_serialport(hDev, buf, length);
}
}
